<p>
  <a
    href="https://i0.wp.com/pic.4khd.com/-bQMPDUqAZac/ZZazxlcLjDl/AAAAAAAAhgc/7Liy1YjOejkEZoR26trGzl9Z4oAi62XRQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-001.webp?w=1300"
    ><img
      loading="lazy"
      decoding="async"
      src="https://i0.wp.com/pic.4khd.com/-bQMPDUqAZac/ZZazxlcLjDl/AAAAAAAAhgc/7Liy1YjOejkEZoR26trGzl9Z4oAi62XRQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-001.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-YbdmLFe3SXw/ZZazx9bxgEl/AAAAAAAAhgg/dpGyfR_0DUM3gNPiHf8MC1aWMwlRTeGJgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-002.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-YbdmLFe3SXw/ZZazx9bxgEl/AAAAAAAAhgg/dpGyfR_0DUM3gNPiHf8MC1aWMwlRTeGJgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-002.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-g5BD82mq8Ok/ZZazxqIRurl/AAAAAAAAhgY/wnzIieOwv_soRbi5FCxtVu9bEtYXprB3wCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-003.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-g5BD82mq8Ok/ZZazxqIRurl/AAAAAAAAhgY/wnzIieOwv_soRbi5FCxtVu9bEtYXprB3wCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-003.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-F1XUCeL2LXw/ZZazy_bRfol/AAAAAAAAhgk/gdHOIJzKkMMtRx6CTbpzcdjNooEeSFH_ACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-004.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-F1XUCeL2LXw/ZZazy_bRfol/AAAAAAAAhgk/gdHOIJzKkMMtRx6CTbpzcdjNooEeSFH_ACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-004.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-f0ZQcaDp1L8/ZZazza-QSml/AAAAAAAAhgo/RYfmoh3CLas-B9cEED_UEdNqZF8T-JusgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-005.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-f0ZQcaDp1L8/ZZazza-QSml/AAAAAAAAhgo/RYfmoh3CLas-B9cEED_UEdNqZF8T-JusgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-005.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-mu-w65pkSVQ/ZZazzgWn5Ll/AAAAAAAAhgw/RF_8LcECiesd3g6m0Avl2A9tXqar7hTOgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-006.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-mu-w65pkSVQ/ZZazzgWn5Ll/AAAAAAAAhgw/RF_8LcECiesd3g6m0Avl2A9tXqar7hTOgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-006.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-06BkrdrTmVE/ZZazztptzfl/AAAAAAAAhgs/wrg0mBOc_0sbQyJ9MplRhMmr6R69TVWrACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-007.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-06BkrdrTmVE/ZZazztptzfl/AAAAAAAAhgs/wrg0mBOc_0sbQyJ9MplRhMmr6R69TVWrACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-007.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-PZfy1MIyxvE/ZZaz0p508al/AAAAAAAAhg0/SwwzGQ0hDBkQhQEwvdTzKBSr1AP1nrfbgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-008.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-PZfy1MIyxvE/ZZaz0p508al/AAAAAAAAhg0/SwwzGQ0hDBkQhQEwvdTzKBSr1AP1nrfbgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-008.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-KOP0x5VNpCw/ZZaz1cRzwCl/AAAAAAAAhhA/iHpq425RpoksLpVdH9lTqH8KVgCQy196gCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-009.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-KOP0x5VNpCw/ZZaz1cRzwCl/AAAAAAAAhhA/iHpq425RpoksLpVdH9lTqH8KVgCQy196gCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-009.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-pLCRnnNHMWk/ZZaz04oUbCl/AAAAAAAAhg4/V6d33-BuxlUwioM5vIEGHjoVx6wiHYabQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-010.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-pLCRnnNHMWk/ZZaz04oUbCl/AAAAAAAAhg4/V6d33-BuxlUwioM5vIEGHjoVx6wiHYabQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-010.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-7CaOmzPj6xU/ZZaz1VJ8YLl/AAAAAAAAhg8/tpZX5sPuJ64D4o1H4lBBW2lR508HYsEVQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-011.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-7CaOmzPj6xU/ZZaz1VJ8YLl/AAAAAAAAhg8/tpZX5sPuJ64D4o1H4lBBW2lR508HYsEVQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-011.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-JxLQ-QB2VrA/ZZaz2G7B8ql/AAAAAAAAhhE/8f-40Ky7OlsjtMrujRV98bs-zSmGqcdcQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-012.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-JxLQ-QB2VrA/ZZaz2G7B8ql/AAAAAAAAhhE/8f-40Ky7OlsjtMrujRV98bs-zSmGqcdcQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-012.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-8Vgf6edW0bI/ZZaz2rhqkMl/AAAAAAAAhhM/dy-frcXN7awkcYEG-W8gpbSHemhmkQdkwCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-013.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-8Vgf6edW0bI/ZZaz2rhqkMl/AAAAAAAAhhM/dy-frcXN7awkcYEG-W8gpbSHemhmkQdkwCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-013.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-2TXE62Jh934/ZZaz2Vj-lyl/AAAAAAAAhhI/lYcvX888UQ09lLV8hW-N1IvJtlcoxU4RACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-014.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-2TXE62Jh934/ZZaz2Vj-lyl/AAAAAAAAhhI/lYcvX888UQ09lLV8hW-N1IvJtlcoxU4RACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-014.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-psXa1uR5zJY/ZZaz26HUGfl/AAAAAAAAhhQ/fiBgJ08EzTUXKFfxcxaiLllMG_en3sIxQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-015.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-psXa1uR5zJY/ZZaz26HUGfl/AAAAAAAAhhQ/fiBgJ08EzTUXKFfxcxaiLllMG_en3sIxQCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-015.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-AD-fJE34ThM/ZZaz4Ehg2Dl/AAAAAAAAhhc/we0uBoTsmkU8xggWDGRhfeAUFxVv4-TZACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-016.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-AD-fJE34ThM/ZZaz4Ehg2Dl/AAAAAAAAhhc/we0uBoTsmkU8xggWDGRhfeAUFxVv4-TZACNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-016.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-lR_9UX3M6lw/ZZaz4Fykwil/AAAAAAAAhhU/mLSOXiFZ7eYZO-mNiRSv1VA53AZu_vo9gCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-017.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-lR_9UX3M6lw/ZZaz4Fykwil/AAAAAAAAhhU/mLSOXiFZ7eYZO-mNiRSv1VA53AZu_vo9gCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-017.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-N0SgxrgtTiE/ZZaz4Hmb75l/AAAAAAAAhhY/MNSKCyDcfsU4aQHgCVMfPFaapA9TkS5lgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-018.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-N0SgxrgtTiE/ZZaz4Hmb75l/AAAAAAAAhhY/MNSKCyDcfsU4aQHgCVMfPFaapA9TkS5lgCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-018.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-mSmZ52y-Opg/ZZaz5FmX81l/AAAAAAAAhhg/RtKvhtWkRJI5QmE6-Mh7gbDDglb5gAZuwCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-019.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-mSmZ52y-Opg/ZZaz5FmX81l/AAAAAAAAhhg/RtKvhtWkRJI5QmE6-Mh7gbDDglb5gAZuwCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-019.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <a
    href="https://i0.wp.com/pic.4khd.com/-PdLdJSh9fTg/ZZaz6ePKMHl/AAAAAAAAhho/6bEWsgbsdrAoVukdsdBTvDsmGQ9C44--wCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-020.webp?w=1300"
    ><img
      decoding="async"
      loading="lazy"
      src="https://i0.wp.com/pic.4khd.com/-PdLdJSh9fTg/ZZaz6ePKMHl/AAAAAAAAhho/6bEWsgbsdrAoVukdsdBTvDsmGQ9C44--wCNcBGAsYHQ/w1300-rw/crazy-cat-ss-black-dress-4khd.com-020.webp?w=1300"
      width="1300"
      height="1500"
      alt="" /></a
  ><br />
  <!-- /wp:gallery -->
</p>

https://img.4khd.com/-cccv_Ia9jD8/YzR_NmINCXl/AAAAAAAB4h0/iuWr85s_gk4IC9jUGcb7YIu49IA6zrSMQCNcBGAsHYQ/w1300-rw/coseryuuhui-yuhui-no-001-cat-head-black-skirt-0527-00001.webp?w=1300
https://img.4khd.com/-vskCGB8MRg8/YzR_Nt9-0fl/AAAAAAAB4h4/oN3DQupezvAZIItLJCRNPScCpLfwF1F1wCNcBGAsHYQ/w1300-rw/coseryuuhui-yuhui-no-001-cat-head-black-skirt-0528-00002.webp?w=1300
https://www.4khd.com/content/05/moriluo-foundation-sakura-ryu-01e4k.html
['"https://www.4khd.com',
'"https://www.4khd.com/content/20/crazy-cat-ss-bathroom-of-thoughts.html',
'"https://www.4khd.com/content/20/crazy-cat-ss-bathroom-of-thoughts.html',
'"https://www.4khd.com/content/05/crazy-cat-ss-thoughts-underwear.html',
'"https://www.4khd.com/content/05/crazy-cat-ss-thoughts-underwear.html',
'"https://www.4khd.com/content/03/%e7%96%af%e7%8c%abss-%e6%80%9d%e7%bb%aa%e4%b9%8bjk346mb-33photos.html',
'"https://www.4khd.com/content/03/%e7%96%af%e7%8c%abss-%e6%80%9d%e7%bb%aa%e4%b9%8bjk346mb-33photos.html',
'"https://www.4khd.com/content/30/crazy-cat-ss-yinglili.html',
'"https://www.4khd.com/content/30/crazy-cat-ss-yinglili.html',
'"https://www.4khd.com/content/28/crazy-cat-ss-halloween-little-devil.html',
'"https://www.4khd.com/content/28/crazy-cat-ss-halloween-little-devil.html',
'"https://www.4khd.com/content/26/crazy-cat-ss-bunny-girl.html',
'"https://www.4khd.com/content/26/crazy-cat-ss-bunny-girl.html',
'"https://www.4khd.com/content/25/crazy-cat-ss-the-sailor-uniform-at-the-same-table.html',
'"https://www.4khd.com/content/25/crazy-cat-ss-the-sailor-uniform-at-the-same-table.html',
'"https://www.4khd.com/content/24/crazy-cat-ss-gym-clothes.html',
'"https://www.4khd.com/content/24/crazy-cat-ss-gym-clothes.html',
'"https://www.4khd.com/content/23/crazy-cat-ss-girl.html',
'"https://www.4khd.com/content/23/crazy-cat-ss-girl.html',
'"https://www.4khd.com/content/23/crazy-cat-ss-sagiri.html',
'"https://www.4khd.com/content/23/crazy-cat-ss-sagiri.html',
'"https://www.4khd.com/content/22/crazy-cat-ss-japanese-jk.html',
'"https://www.4khd.com/content/22/crazy-cat-ss-japanese-jk.html',
'"https://www.4khd.com/content/20/crazy-cat-ss-qiongmei-2.html',
'"https://www.4khd.com/content/20/crazy-cat-ss-qiongmei-2.html']
https://www.4khd.com/content/ import re import time import os import requests #
设置请求头 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Edg/121.0.0.0' } # 定义基础 URL url_base = 'https://tkmmy.xxtt.info/content/'
url_name = '20/crazy-cat-ss-bathroom-of-thoughts.html' # 调整为你的具体 URL page
= '' # 初始页码设置为空 # 发送请求获取 HTML 代码 response =
requests.get(url_base + url_name + page, headers=headers) html = response.text
print(response.text) # 提取文件夹名称 dir_name = re.findall(r'
<h3
  style="font-style: normal; font-weight: 400"
  class="wp-block-post-title has-medium-font-size"
>
  (.*?)
</h3>
', html)[-1] print(f"Folder Name: {dir_name}") # 文件夹名字 # 提取照片数量
photos_num = re.findall(r'MB-(\d+)photos', html) photos_num = int(photos_num[0])
if photos_num else 0 print(f"Total Photos: {photos_num}") # 照片数量 #
创建文件夹 if not os.path.exists(dir_name): os.makedirs(dir_name) #
下载每一页的照片 for page_num in range(1, (photos_num - 1) // 20 + 2): #
计算需要下载的页数 # 定义当前页面的 URL page_suffix = f"/{page_num}" if page_num
> 1 else "" response = requests.get(url_base + url_name + page_suffix,
headers=headers) html = response.text # 提取照片 URL urls =
re.findall(r'src="(.*?)" width="1300" height="1500"', html) print(f"Downloading
URLs from page {page_num}, found {len(urls)} URLs.") # 保存每一张照片 for url in
urls: time.sleep(0.3) # 延迟以防被限制 file_name = url.split('.')[-2] + '.png'
print('正在下载', file_name) response = requests.get(url) with open(dir_name +
'/' + file_name, 'wb') as file: file.write(response.content)
print("所有照片下载完成！")
这是下载一套图的,每套图有url_name,我有写了一个获取url_name的, iurl_base =
'https://tkmmy.xxtt.info/search/' iurl_name = '%E7%96%AF%E7%8C%AB' ipage =
'/page/1' response = requests.get(iurl_base + iurl_name + ipage,headers=headers)
ihtml = response.text print(response.text)
#href="https://www.4khd.com/content/04/crazy-cat-ss-black-dress.html"
target="_self" idir_name = re.findall(r'href=(.*?)" target="_self"',ihtml)
print(idir_name)# # 使用 set 去重 unique_urls = set(idir_name) # 提取
https://www.4khd.com/content/ 后面的部分 # 可以使用列表推导式和字符串操作获取
trimmed_urls = [url.replace('https://www.4khd.com/content/', '') for url in
unique_urls]
trimmed_urls就是url_name,我的意思就是当第一套图下载完了,就把url_name更换下一个,内容在trimmed_urls里
